<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Rolls back a transaction in progress</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.stomp.html">Stomp</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="stomp.ack.html">Stomp::ack</a></div>
 <div class="up"><a href="class.stomp.html">Stomp</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="stomp.abort" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Stomp::abort</h1>
  <h1 class="refname">stomp_abort</h1>
  <p class="verinfo">(PECL stomp &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">Stomp::abort</span> -- <span class="refname">stomp_abort</span> &mdash; <span class="dc-title">Rolls back a transaction in progress</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-stomp.abort-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格 (method):</p>
   <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>Stomp::abort</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$transaction_id</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$headers</code></span>
   ] )</div>

  <p class="para rdfs-comment">过程化风格:</p>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>stomp_abort</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$transaction_id</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$headers</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Rolls back a transaction in progress.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-stomp.abort-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    <dt>
<em><code class="parameter">link</code></em></dt>
<dd>
<p class="para">仅对过程化样式：由 <span class="function"><a href="stomp.construct.html" class="function">stomp_connect()</a></span> 返回的 stomp 连接标识符。</p></dd>

    
     <dt>
<em><code class="parameter">transaction_id</code></em></dt>

     <dd>

      <p class="para">
       The transaction to abort.
      </p>
     </dd>

    
    <dt>
<em><code class="parameter">headers</code></em></dt>
<dd>
<p class="para">关联数组包含附加的头信息（例如： receipt）。</p></dd>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-stomp.abort-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-stomp.abort-notes">
  <h3 class="title">注释</h3>
  <div class="tip"><strong class="tip">Tip</strong><p class="simpara">Stomp is inherently asynchronous. Synchronous communication can be implemented adding a receipt header. This will cause methods to not return anything until the server has acknowledged receipt of the message or until read timeout was reached.</p></div>
 </div>


 <div class="refsect1 examples" id="refsect1-stomp.abort-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4538">
    <p><strong>Example #1 面向对象风格</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/*&nbsp;connection&nbsp;*/<br /></span><span style="color: #007700">try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$stomp&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Stomp</span><span style="color: #007700">(</span><span style="color: #DD0000">'tcp://localhost:61613'</span><span style="color: #007700">);<br />}&nbsp;catch(</span><span style="color: #0000BB">StompException&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;die(</span><span style="color: #DD0000">'Connection&nbsp;failed:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">());<br />}<br /><br /></span><span style="color: #FF8000">/*&nbsp;begin&nbsp;a&nbsp;transaction&nbsp;*/<br /></span><span style="color: #0000BB">$stomp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">begin</span><span style="color: #007700">(</span><span style="color: #DD0000">'t1'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;send&nbsp;a&nbsp;message&nbsp;to&nbsp;the&nbsp;queue&nbsp;*/<br /></span><span style="color: #0000BB">$stomp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">send</span><span style="color: #007700">(</span><span style="color: #DD0000">'/queue/foo'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">'transaction'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'t1'</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">/*&nbsp;rollback&nbsp;*/<br /></span><span style="color: #0000BB">$stomp</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">abort</span><span style="color: #007700">(</span><span style="color: #DD0000">'t1'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;close&nbsp;connection&nbsp;*/<br /></span><span style="color: #007700">unset(</span><span style="color: #0000BB">$stomp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-4539">
    <p><strong>Example #2 过程化风格</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/*&nbsp;connection&nbsp;*/<br /></span><span style="color: #0000BB">$link&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">stomp_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'tcp://localhost:61613'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;check&nbsp;connection&nbsp;*/<br /></span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">$link</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;die(</span><span style="color: #DD0000">'Connection&nbsp;failed:&nbsp;'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">stomp_connect_error</span><span style="color: #007700">());<br />}<br /><br /></span><span style="color: #FF8000">/*&nbsp;begin&nbsp;a&nbsp;transaction&nbsp;*/<br /></span><span style="color: #0000BB">stomp_begin</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'t1'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;send&nbsp;a&nbsp;message&nbsp;to&nbsp;the&nbsp;queue&nbsp;'foo'&nbsp;*/<br /></span><span style="color: #0000BB">stomp_send</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'/queue/foo'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'bar'</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #DD0000">'transaction'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'t1'</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">/*&nbsp;rollback&nbsp;*/<br /></span><span style="color: #0000BB">stomp_abort</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'t1'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;close&nbsp;connection&nbsp;*/<br /></span><span style="color: #0000BB">stomp_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

   </div>
  </p>
 </div>



</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.stomp.html">Stomp</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="stomp.ack.html">Stomp::ack</a></div>
 <div class="up"><a href="class.stomp.html">Stomp</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
